Skip to content

Conversation

@tgross35
Copy link
Contributor

@tgross35 tgross35 commented Nov 19, 2025

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests should_panic otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from

#[cfg(any(
target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "netbsd",
target_os = "openbsd",
target_os = "cygwin",
target_os = "illumos",
target_os = "aix",
target_vendor = "apple",
))]
pub fn lock(&self) -> io::Result<()> {
cvt(unsafe { libc::flock(self.as_raw_fd(), libc::LOCK_EX) })?;
return Ok(());
}
#[cfg(target_os = "solaris")]
pub fn lock(&self) -> io::Result<()> {
. Windows also supports file locks, all other platforms are unsupported.

The list of platforms for which file locks are tested is smaller than
the list of platforms that support it. Synchronize these here.

Link: https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2025

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@tgross35

This comment was marked as outdated.

@tgross35
Copy link
Contributor Author

Sorry bors3

@bors2 try jobs=arm-android,test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 19, 2025
fs: Run file lock tests on all platforms that support it

try-job: arm-android
try-job: test-various
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 19, 2025

💔 Test for 534bfac failed: CI. Failed jobs:

Rather than skipping the tests, make sure that they fail. This ensures
that if file locking support is added for more platforms in the future,
the tests don't wind up quietly skipped.
@tgross35
Copy link
Contributor Author

@bors2 try jobs=arm-android,test-various

rust-bors bot added a commit that referenced this pull request Nov 19, 2025
fs: Run file lock tests on all platforms that support it

try-job: arm-android
try-job: test-various
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 20, 2025

☀️ Try build successful (CI)
Build commit: eb7fa5a (eb7fa5adff9becc0b258d7730b9afab7defca4d6, parent: 07bdbaedc63094281483c40a88a1a8f2f8ffadc5)

@mati865
Copy link
Member

mati865 commented Nov 20, 2025

FYI, you no longer need to call bors2 because bors try already uses the new one: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20try.20builds.20with.20new.20bors/near/530101996

@tgross35
Copy link
Contributor Author

Thanks! I know it works now, just something that I ingrained pretty hard after having caused a try->r+ shootthrough to master a while back.

@ChrisDenton
Copy link
Member

I'm slightly nervous that something will break on full CI but let's find out...

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 20, 2025

📌 Commit cea9dd8 has been approved by ChrisDenton

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 20, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 20, 2025
…enton

fs: Run file lock tests on all platforms that support it

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests `should_panic` otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308. Windows also supports file locks, all other platforms are unsupported.
bors added a commit that referenced this pull request Nov 20, 2025
Rollup of 9 pull requests

Successful merges:

 - #149033 (autodiff rlib handling)
 - #149088 (Add missing trailing period to RustDoc for fn create_dir().)
 - #149111 (fs: Run file lock tests on all platforms that support it)
 - #149113 (sgx: avoid unnecessarily creating a slice)
 - #149123 (std: sys: fs: uefi: Fix FileAttr size)
 - #149125 (In `BTreeMap::eq`, do not compare the elements if the sizes are different.)
 - #149133 (Remove an unused variable)
 - #149134 (std: sys: net: uefi: Implement read_vectored)
 - #149139 (Enable host tools for aarch64-unknown-linux-ohos)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 20, 2025
…enton

fs: Run file lock tests on all platforms that support it

There are a number of platforms that support file locking but aren't getting tested. Synchronize the list and mark the tests `should_panic` otherwise, to make sure they get updated if more platforms add locking support.

The supported platform list comes from https://github.com/rust-lang/rust/blob/07bdbaedc63094281483c40a88a1a8f2f8ffadc5/library/std/src/sys/fs/unix.rs#L1291-L1308. Windows also supports file locks, all other platforms are unsupported.
bors added a commit that referenced this pull request Nov 20, 2025
Rollup of 9 pull requests

Successful merges:

 - #149033 (autodiff rlib handling)
 - #149088 (Add missing trailing period to RustDoc for fn create_dir().)
 - #149111 (fs: Run file lock tests on all platforms that support it)
 - #149113 (sgx: avoid unnecessarily creating a slice)
 - #149123 (std: sys: fs: uefi: Fix FileAttr size)
 - #149133 (Remove an unused variable)
 - #149139 (Enable host tools for aarch64-unknown-linux-ohos)
 - #149144 (Reject `async fn` in `const impl` during AST validation)
 - #149154 (Fix platform supports docs tiny typo)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants